<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:output method="xml" indent="yes"/>
	<xsl:template match="/">
		<xsl:for-each select="//Attribute_Category_ID[not(.=following::Attribute_Category_ID)]">
		<xsl:sort select="."/>
			<xsl:if test="not(preceding-sibling::text()=current()/text())">
			<param1>
				<Attribute_Category_ID><xsl:value-of select="."/></Attribute_Category_ID>
				<xsl:for-each select="/root/param1[Attribute_Category_ID=current()]">
					<AttrCatId>
						<AttributeID>
							<xsl:value-of select="AttrCatId/AttributeID"/>
						</AttributeID>
						<Attribute_Category_Value>
							<xsl:value-of select="AttrCatId/Attribute_Category_Value"/>
						</Attribute_Category_Value>
					</AttrCatId>
				</xsl:for-each>
			</param1>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>
